#!/bin/bash
#DT=`date -d '-1 day' +%Y-%m-%d`
DT='2023-05-28'

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://192.168.88.80:3306/scrm?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username root \
--password 123456 \
--query "select *, '${DT}' as dt from customer_relationship where 1=1 and  \$CONDITIONS" \
--hcatalog-database edu_ods \
--hcatalog-table ods_customer_relationship \
-m 1


/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://192.168.88.80:3306/scrm?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username root \
--password 123456 \
--query "select *, '${DT}' as dt from customer_appeal where 1=1 and  \$CONDITIONS" \
--hcatalog-database edu_ods \
--hcatalog-table ods_customer_appeal \
-m 1

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://192.168.88.80:3306/scrm?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username root \
--password 123456 \
--query "select *, '${DT}' as dt from itcast_clazz where 1=1 and  \$CONDITIONS" \
--hcatalog-database edu_ods \
--hcatalog-table ods_itcast_clazz \
-m 1

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://192.168.88.80:3306/scrm?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username root \
--password 123456 \
--query "select *, '${DT}' as dt from employee where 1=1 and  \$CONDITIONS" \
--hcatalog-database edu_ods \
--hcatalog-table ods_employee \
-m 1

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://192.168.88.80:3306/scrm?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username root \
--password 123456 \
--query "select *, '${DT}' as dt from scrm_department where 1=1 and  \$CONDITIONS" \
--hcatalog-database edu_ods \
--hcatalog-table ods_scrm_department \
-m 1

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://192.168.88.80:3306/scrm?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username root \
--password 123456 \
--query "select *, '${DT}' as dt from customer_clue where 1=1 and  \$CONDITIONS" \
--hcatalog-database edu_ods \
--hcatalog-table ods_customer_clue \
-m 1

